package com.seari.dto;

import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 设备台账和设备信息维护请求类
 *
 * @Author: zyk
 * @Date: 2020/1/8 13:43
 * @Version 1.0
 */
public class EquipmentLedgerAndInfoMaintenanceRequest {

    /**
     * 系统名称
     */
    private String systemName;

    /**
     * 设备类型
     */
    private String etType;

    /**
     * 设备code
     */
    private String etCode;

    /**
     * 模糊查询字段
     */
    private String match;

    /**
     * 站点id
     */
    private List<String> stationIds;

    /**
     * 导出表格的名称
     */
    private String fileName;

    /**
     * 页数
     */
    private Integer page;

    /**
     * 每页显示个数
     */
    private Integer limit;

    public String getSystemName() {
        if(StringUtils.isNotBlank(this.systemName)){
            this.systemName = (this.systemName.split(" "))[0];
        }
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    public String getEtType() {
        if(StringUtils.isNotBlank(this.etType)){
            return (this.etType.split(" "))[0];
        }
        return null;
    }

    public String getEtCode(){
        if(StringUtils.isNotBlank(this.etType)){
            String[] strings = this.etType.split(" ");
            if(strings.length > 1){
                this.etCode = (strings)[1];
            }
        }
        return etCode;
    }

    public void setEtType(String etType) {
        this.etType = etType;
    }

    public String getMatch() {
        return match;
    }

    public void setMatch(String match) {
        this.match = match;
    }

    public List<String> getStationIds() {
        return stationIds;
    }

    public void setStationIds(List<String> stationIds) {
        this.stationIds = stationIds;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public Integer getStart(){
        if(this.page != null && this.limit != null){
            return (this.page -1) * this.limit;
        }
        return null;
    }

	@Override
	public String toString() {
		return "EquipmentLedgerAndInfoMaintenanceRequest [systemName="
				+ systemName + ", etType=" + etType + ", etCode=" + etCode
				+ ", match=" + match + ", stationIds=" + stationIds
				+ ", fileName=" + fileName + ", page=" + page + ", limit="
				+ limit + "]";
	}
    
}
